﻿@using PagedList.Mvc;
@model PagedList.IPagedList<WEBBANGDIA.Models.BangDia>
@{
    ViewBag.Title = "Trang chủ";
    Layout = "~/Views/Shared/GiaoDien.cshtml";
}
<script type="text/javascript">
    $(function () {
        $('#form0').submit(function () {
            if ($(this).valid()) {
                $.ajax({
                    url: this.action, type: this.method, data: $(this).serialize(), success: function (result) {
                        $('#ajaxUpdate').html(result);
                    }
                });
            }
        });
        return false;
    });
</script>
<!-- Start WOWSlider.com BODY section --> <!-- add to the <body> of your page -->
@*<div id="wowslider-container0">
        <div class="ws_images">
            <ul>
                <li><img src="~/Content/Slide/data0/images/img_8791.jpg" alt="IMG_8791" title="IMG_8791" id="wows1_0" /></li>
                <li><img src="~/Content/Slide/data0/images/img_8792.jpg" alt="IMG_8792" title="IMG_8792" id="wows1_1" /></li>
                <li><img src="~/Content/Slide/data0/images/img_8793.jpg" alt="IMG_8793" title="IMG_8793" id="wows1_2" /></li>
                <li><img src="~/Content/Slide/data0/images/img_8794.jpg" alt="IMG_8794" title="IMG_8794" id="wows1_3" /></li>
                <li><img src="~/Content/Slide/data0/images/img_8795.jpg" alt="IMG_8795" title="IMG_8795" id="wows1_4" /></li>
                <li><img src="~/Content/Slide/data0/images/img_8796.jpg" alt="IMG_8796" title="IMG_8796" id="wows1_5" /></li>
                <li><img src="~/Content/Slide/data0/images/img_8797.jpg" alt="IMG_8797" title="IMG_8797" id="wows1_6" /></li>
                <li><img src="~/Content/Slide/data0/images/img_8798.jpg" alt="IMG_8798" title="IMG_8798" id="wows1_7" /></li>
                <li><img src="~/Content/Slide/data0/images/img_8799.jpg" alt="IMG_8799" title="IMG_8799" id="wows1_8" /></li>
                <li><img src="~/Content/Slide/data0/images/img_8800.jpg" alt="IMG_8800" title="IMG_8800" id="wows1_9" /></li>
                <li><img src="~/Content/Slide/data0/images/img_8801.jpg" alt="IMG_8801" title="IMG_8801" id="wows1_10" /></li>
                <li><a href="http://wowslider.com/vf"><img src="data1/images/img_8842.jpg" alt="full screen slider" title="IMG_8842" id="wows1_41" /></a></li>
                <li><img src="data1/images/img_8843.jpg" alt="IMG_8843" title="IMG_8843" id="wows1_42" /></li>
            </ul>
        </div>
        <div class="ws_bullets">
            <div>
                <a href="#" title="IMG_8791"><img src="~/Content/Slide/data0/tooltips/img_8791.jpg" alt="IMG_8791" />1</a>
                <a href="#" title="IMG_8792"><img src="~/Content/Slide/data0/tooltips/img_8792.jpg" alt="IMG_8792" />2</a>
                <a href="#" title="IMG_8793"><img src="~/Content/Slide/data0/tooltips/img_8793.jpg" alt="IMG_8793" />3</a>
                <a href="#" title="IMG_8794"><img src="~/Content/Slide/data0/tooltips/img_8794.jpg" alt="IMG_8794" />4</a>
                <a href="#" title="IMG_8795"><img src="~/Content/Slide/data0/tooltips/img_8795.jpg" alt="IMG_8795" />5</a>
                <a href="#" title="IMG_8796"><img src="~/Content/Slide/data0/tooltips/img_8796.jpg" alt="IMG_8796" />6</a>
                <a href="#" title="IMG_8797"><img src="~/Content/Slide/data0/tooltips/img_8797.jpg" alt="IMG_8797" />7</a>
                <a href="#" title="IMG_8798"><img src="~/Content/Slide/data0/tooltips/img_8798.jpg" alt="IMG_8798" />8</a>
                <a href="#" title="IMG_8799"><img src="~/Content/Slide/data0/tooltips/img_8799.jpg" alt="IMG_8799" />9</a>
                <a href="#" title="IMG_8800"><img src="~/Content/Slide/data0/tooltips/img_8800.jpg" alt="IMG_8800" />10</a>
            </div>
        </div><span class="wsl"><a href="http://wowslider.com/vu">image carousel</a> by WOWSlider.com v7.2</span>
        <div class="ws_shadow"></div>
    </div>*@
<script src="~/Content/Slide/engine0/wowslider.js"></script>
<script src="~/Content/Slide/engine0/script.js"></script>
<!-- End WOWSlider.com BODY section -->
<div id="ajaxUpdate">
    @using (Ajax.BeginForm(new AjaxOptions() { UpdateTargetId = "ajaxUpdate", OnBegin = "BeginClient" }))
    {
        
        if (Model != null)
        {
            using (Html.BeginForm("Index", "Home", FormMethod.Get))
                {
                    <div style="float: left; padding-right: 5%; padding-bottom: 13px; margin-bottom: 10px; padding-top: 15px; width: 45%; text-align: right; background: #FFFFFF; border-bottom: 2px solid #808080; ">
                        Tiêu chí:
                        <select id="dropdown" title="Sắp xếp" name="dropdown" class="">
                            <option value="0">--Chọn--</option>
                            <option value="1">Theo thứ tự A - Z </option>
                            <option value="2">Giá tăng dần</option>
                            <option value="3">Giá giảm dần</option>
                            <option value="4">Lượt xem giảm dần</option>
                            <option value="5">Lượt mua giảm dần</option>
                            <option value="6">Lượt thuê giảm dần</option>
                        </select>
                        <input type="submit" value="Sắp xếp" />
                    </div>
                    <script type="text/javascript">
                        $('#dropdown').val('@Session["Home"]');
                    </script>
                }
            <div id="listproduct">
                @foreach (var item in Model)
                {
                    <div class="product">
                        <div class="title">@Html.DisplayFor(itemBd => @item.TenBD)</div>
                        @if (string.IsNullOrEmpty(item.AnhDaiDien))
                        {
                            item.AnhDaiDien = @"Temp/DVD.gif";
                        }
                        <a href="#">
                            <img src="/Images/@Html.DisplayFor(itemBd=>@item.AnhDaiDien)" />
                        </a>

                        <div class="money">@Html.DisplayFor(ItemBd => @item.Gia)</div>
                        <div class="details">
                            @Html.ActionLink("Chi tiết", "Details", "Home", new { id = @item.MaBD }, null);
                        </div>
                        <div class="dathang">
                            <a href="#">Dat hang</a>
                        </div>
                    </div>
                        Session["idDm"] = item.DanhMuc.MaDM;
                }
                @Html.PagedListPager(Model, page => Url.Action("All", new { idDm = Convert.ToInt32(Session["idDm"]), page = page }), PagedListRenderOptions.OnlyShowFivePagesAtATime);
            </div>
        }
        else
        {
            <div class="middle" style="padding: 0px;">
                <div class="list">
                    @Html.Raw("<p>Không có sản phẩm nào!</p>")
                </div>
            </div>
        }

        <script type="text/javascript">
            function SapXep(id) {
                $.post("/trang-chu", { "id": id });
            }
        </script>
    }
</div>
